<?php 
    include_once '../sql_connect.php'; 
    include_once '../msg_redirect.php';
    include_once '../timeConverter.php';
    include_once '../utilities/show_expression.php';
?>
<?php 
	/*返回ajax刷新后的评论内容*/
	
	$comment_content = "";
	$w_id = $_POST[w_id];
	
	/*查询该微博的评论*/
	$comment_sql = mysql_query("SELECT c_id,c_content,c_date,u_no,r_id FROM comment WHERE w_id='$w_id'",$connection);	
    $comment_result = mysql_fetch_array($comment_sql);
	if($comment_result){
		do {
			if($comment_result[r_id]=="0"){
				$comment_content .= "<div class='comment_sbox'><div class='comment_border'></div><div class='comment_img'><a href='##'><img src='";
				
				/*显示头像*/
        		$show_head_sql = mysql_query("select h_data from head where u_no='$comment_result[u_no]'",$connection);
    			$show_head_result = mysql_fetch_array($show_head_sql);
    			$my_data = $show_head_result[h_data];
    			if (!$my_data){
    				$comment_content .=  "head_image/09.jpg";
    					}
    			else $comment_content .=  $my_data;
				$comment_content .= "' width='30' height='30' border='0' /></a></div>";

				$comment_content .=	"<div class='comment_content'>";

				/*显示人名*/
				$show_user = mysql_query("select u_name from user_info where u_no = '$comment_result[u_no]'",$connection);
				$show_user_result = mysql_fetch_array($show_user);
				$comment_content .=	$show_user_result[0].":".$comment_result[c_content]."(".timeConverter($comment_result[c_date]).")";
				$comment_content .=	"</div></div>";	    
			}
			else{
				$comment_content .=	"<div class='comment_sbox'><div class='comment_border'></div><div class='comment_img'><a href='##'><img src='";
				/*显示头像*/
        		$show_head_sql = mysql_query("select h_data from head where u_no='$comment_result[u_no]'",$connection);
    			$show_head_result = mysql_fetch_array($show_head_sql);
    			$my_data = $show_head_result[h_data];
    			if (!$my_data){
    				$comment_content .= "head_image/09.jpg";
    			}
    			else $comment_content .= $my_data;
				$comment_content .= "'width='30' height='30' border='0' /></a></div>";
				$comment_content .= "<div class='comment_content'>";
				/*显示人名*/
				$show_user = mysql_query("select u_name from user_info where u_no = '$comment_result[u_no]'",$connection);
				$show_user_result = mysql_fetch_array($show_user);
				$comment_content .= $show_user_result[0].":";
				$comment_sql2= mysql_query("select u_name from user_info where u_no in(select u_no from comment where c_id='$comment_result[r_id]')",$connection);
				$comment_result2 = mysql_fetch_array($comment_sql2);
				$comment_content .= "回复@".$comment_result2[u_name].":".$comment_result[c_content]."(".timeConverter($comment_result[c_date]).")";
				$comment_content .= "</div></div>";  
			}
		}while ($comment_result = mysql_fetch_array($comment_sql));
	}
	
	echo $comment_content;
?>